package com.datastructure.list;

public class ListTest {
    public static void main(String[] args) {
        System.out.println("开始测试单链表");
        SingleLinkedList singleLinkedList = new SingleLinkedList();
        //testLinkedList(singleLinkedList);
        System.out.println("开始测试双表");
        DoubleLinkedList doubleLinkedList = new DoubleLinkedList();
        testLinkedList(doubleLinkedList);
    }

    public static void testLinkedList(MyList myList) {
        myList.show();

        myList.add(new StudentNode("张三",88));
        myList.add(new StudentNode("李四",66));
        myList.add(new StudentNode("王五",93));
        myList.add(new StudentNode("狗六",77));

        /*
        myList.addByScore(new StudentNode("张三",88));
        myList.addByScore(new StudentNode("李四",72));
        myList.addByScore(new StudentNode("王五",93));
        myList.addByScore(new StudentNode("狗六",88));
         */

        myList.show();

        myList.update(new StudentNode("张三",55));
        myList.update(new StudentNode("李四",65));
        myList.update(new StudentNode("李六",65));
        myList.show();

        myList.del("王五");
        myList.del("王五");
        myList.show();

    }
}
